<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Destructuring</title>
    <script>
        const person = {
            name: 'bbh',
            age: 30,
            address: {
                city: 'ChongQing',
                area: 'NanShan'
            },
            title: ['student',{year:2022, title:'GoodStudent'}]
}

        const {name}=person;
        const {age:year}=person;
        const {address:{city}}=person;
        const {address:{area:mountain}}=person;
        const {title:[title1]}=person;
        const {title:[,{title:title2}]}=person;
        const {title:[,{title}]}=person;
        const {title3='God'}=person;

        console.log(name) // bbh
        console.log(year) // 30
        console.log(city) // ChongQing 
        console.log(mountain) // NanShan //这里没有写错，就是要输出NanShan，结合课件
        console.log(title1) // student
        console.log(title2) // GoodStudent
        console.log(title3) // God 结合课件
    </script>
</head>
<body>
    
</body>
</html>